package com.carpedil.order.controller;

import com.carpedil.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/** @author Administrator */
@RestController
public class OrderController {
  @Autowired OrderService orderService;

  @GetMapping("/order/{orderId}/{movieName}")
  public String payment(
      @PathVariable("orderId") String orderId, @PathVariable("movieName") String movieName) {
    return orderService.payment(orderId, movieName);
  }

  @GetMapping("/success/{movieName}")
  public String finished(@PathVariable("movieName") String movieName) {
    return orderService.finish(movieName);
  }

  @GetMapping("/checkStatus/{orderId}")
  public String checkById(@PathVariable("orderId") String orderId) {
    return orderService.check(orderId);
  }
}
